
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
       
    </style>
    <script src="./dist/vue.js"></script>
</head>
<body>
    <div id="root"></div>
    
</body>
<script>
  const myMixin = {
    stuName: '张三mixin',
    data(){
      return {
        number: 2233
      }
    },
    created(){
      console.log('created mixin')
    },
    methods:{
      handleClick(){
        console.log('mixin click')
      }
    }
  }
  const app = Vue.createApp({
    stuName: '李逵',
    created(){
      console.log('created')
    },
      data(){
          return {
            // number: 1
            name: 'dell'
          }
      },
      mixins:[myMixin],
      methods:{
        // handleClick(){
        //   console.log('handleClick')
        // }
      },
      template:
      ` 
      <div>{{ number }}</div>
      <div>{{ name }}</div> 
      <div>{{ this.$options.stuName }}</div>
      <div @click='handleClick'>点击</div>
      `
  });

  app.component('demo', {
      template:
        `
          
      `
  });

  app.config.optionMergeStrategies.stuName = (mixValue, appValue, vm) => {
    return mixValue || appValue 
  }
    const vm = app.mount("#root");
</script>
</html>